package com.buddy.sds.auth.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.buddy.sds.common.BaseEntity;
import com.buddy.sds.common.jackson.LocalDateTimeJsonDeserializer;
import com.buddy.sds.common.jackson.LocalDateTimeJsonSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
@TableName("t_system_user")
public class SystemUser  implements BaseEntity {

    @TableId(type = IdType.UUID)
    private String userId;

    private String userName;

    private String userNickname;

    private String userPassword;

    private boolean userLock;

    private String userHeadimg;

    @JsonSerialize(using = LocalDateTimeJsonSerializer.class)
    @JsonDeserialize(using = LocalDateTimeJsonDeserializer.class)
    @TableField(strategy= FieldStrategy.IGNORED)
    private LocalDateTime userExpire;


    @JsonSerialize(using = LocalDateTimeJsonSerializer.class)
    @JsonDeserialize(using = LocalDateTimeJsonDeserializer.class)
    private LocalDateTime userCreatetime;

    @TableField(exist = false)
    private List<SystemRole> roles = Collections.EMPTY_LIST;

    private String userDepartment;

    @TableField(exist = false)
    private SystemDepartment department;

}
